import getCurrentColor from "~background/actions/getCurrentColor";
import {executeInCurrentTab} from "~background/utils";

const highlightImage = async () => {
  function contentScriptHighlightImage(currentColor) {
    if (window.top !== window.self) return; // JM：iframe调用检查
    window.highlighterAPI.highlightImage.create(currentColor);
  }

  const currentColor = await getCurrentColor();
  executeInCurrentTab({ func: contentScriptHighlightImage, args: [currentColor] });
}

export default highlightImage;
